﻿
namespace SCB.Presentation.Helpers
{
    public class Utilities
    {
        private const string ViewFormat = "{0}/{1}/{2}";
        private const string ViewSearchFormat = "{0}/{1}/{2}?keyword={2}";
        private const string ProductsViewFormat = "{0}/{1}?keyword={2}";
        
        private const string ProductView = "/Product";
        private const string CategoryView = "/Category";
        private const string ProductDetailAction = "Productdetail";
        private const string CategoryDetailAction = "Display";
        private const string ProductProductsAction = "Products";

        public static string GetProductDetailView(int id, string keyword = "")
        {
            return string.IsNullOrEmpty(keyword) ? string.Format(ViewFormat, ProductView, ProductDetailAction, id) :
                string.Format(ViewSearchFormat, ProductView, ProductDetailAction, id, keyword);
        }

        public static string GetCategoryDetailView(int id, string keyword = "")
        {
            return string.IsNullOrEmpty(keyword) ? string.Format(ViewFormat, CategoryView, CategoryDetailAction, id) :
                string.Format(ViewSearchFormat, CategoryView, CategoryDetailAction, id, keyword);
        }

        public static string GetProductsView(string title)
        {
            return string .Format(ProductsViewFormat, ProductView, ProductProductsAction, title);
        }
    }
}